<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>setTimeout</title>
</head>
<body>
	<script>
		function f1(){
			for(var i=0;i<4;i++){
				var tc=setTimeout(function(i){
					console.log(i);
					clearTimeout(tc);
				}, 10, i);
			}
		}
		function f2(){
			for(var i=0;i<5;i++){
				var tc=setInterval(function(i,tc){
					console.log(i);
					clearTimeout(tc);
				}, 10, i,tc);
			}
		}

		f1();
		f2();
		console.info(2121);
	</script>
</body>
</html>